package reflectPracticeDemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.text.DateFormat.Field;

public class FieldPratice {

	public static void main(String[] args) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
		Class<Student> c = Student.class;
		
		Constructor<Student> constructor = c.getConstructor();
		Student newInstance = constructor.newInstance();
		
		java.lang.reflect.Field age = c.getField("age");
		
		java.lang.reflect.Field name = c.getField("name");
		name.setAccessible(true);
		
		java.lang.reflect.Field number = c.getField("Number");
		
		age.set(newInstance, 11);
		name.set(newInstance, "周杰伦");
		number.set(newInstance, 1);
		
		System.out.println(newInstance);

	}

}
